Many conventional mobile devices such as cellular phones include a digital compass that provides a heading of the device that can be useful for applications such as navigation. However, the actual heading of the device may not be the heading that is needed for all applications. For example, when a mobile device is placed in a holder that is mounted in a fixed tilt angle in a car, the heading that is of interest is the heading of the movement of the car, and not the device itself. Certain techniques have been developed to produce the tilt compensated heading of the mobile device through use of MEMS magnetic sensor and accelerometer. However, these techniques are not useful for obtaining a heading direction in all applications, such as when a mobile device is being held by a person who is walking.